/* psw.t   PRODUCT STRUCTURE WRITE TRIGGER                                  */

TRIGGER PROCEDURE FOR WRITE OF PS_MSTR OLD BUFFER OLD_PS_MSTR.


	{mfdeclre.i }
	define new shared work-table wf_old_ps_mstr like ps_mstr.

	/* fdn 2004/10/28 Modify Record processing */
	HK:
	do:
        if not can-find ( first dt_mstr where dt_table = "ps_mstr" and dt_type = "MOD" ) then leave HK.
        
        if not can-find ( first wf_old_ps_mstr ) then do:
            create wf_old_ps_mstr.
            if recid(wf_old_ps_mstr)= -1 then .
        end.
        
        buffer-copy old_ps_mstr to wf_old_ps_mstr no-error.

        for each dt_mstr no-lock where dt_table = "ps_mstr" and dt_type = "MOD" :
        
        	run value(global_user_lang_dir + "hk/hktrigmod.p")
       			"wf_old_ps_mstr"		/*old buffer*/
       			"ps_mstr"				/*new buffer*/
       			dt_table				/*table name*/
       			dt_field				/*field name*/
       			dt_type					/*type*/
       			recid(ps_mstr)			/*key*/	
       			ps_mstr.ps_par			/*key1*/
       			ps_mstr.ps_comp			/*key2*/
       			ps_mstr.ps_ref			/*key3*/
       			string(ps_mstr.ps_start)	/*key4*/
       			""						/*key5*/
       			""						/*key6*/
       			""						/*key7*/
       			""						/*key8*/
       			.
			
        end.
	end.
